<?php
/**
 * 所属项目 ts1108.
 * 开发者: 想天
 * 创建日期: 1/3/14
 * 创建时间: 9:03 PM
 * 版权所有 想天工作室(www.ourstu.com)
 */
tsload(APPS_PATH . '/admin/Lib/Action/AdministratorAction.class.php');

class AdminAction extends AdministratorAction
{

    public function _initialize()
    {
        $this->pageTitle['index'] = '配置首页';
        $this->pageTab[] = array('title' => '配置首页', 'tabHash' => 'index', 'url' => U('Tpl/Admin/index'));
        $this->pageTab[] = array('title' => '自动升级', 'tabHash' => 'update', 'url' => U('Tpl/Admin/update'));
        parent::_initialize();
    }

    public function index()
    {

        $this->pageKeyList = array('BANK_LIMIT');
        $this->displayConfig();
    }

    public function doUpdate()
    {
        $sql_file = APPS_PATH . '/cat/update.sql';
        $res = D('')->executeSqlFile($sql_file);
        model('Lang')->createCacheFile('PUBLIC', 0);
        if (!empty($res)) {
            echo $res['error_code'];
            echo '<br />';
            echo $res['error_sql'];
            // 清除已导入的数据
            exit;
        } else {
            echo '升级成功。';
        }


    }

    public function doSql()
    {
        D('')->execute($_POST['str_sql']);
        $this->ajaxReturn('', '', 1);
    }

} 